﻿using System;
using System.Configuration;
using System.ServiceModel;

namespace In.Api.Helpers
{
    public static class WsClientFactory
    {
        /// <summary>
        /// 获取 广东省妇幼保健院 预约 Web Service 的代理类
        /// </summary>
        /// <returns></returns>
        public static HisWs.DefaultAcceptMessageClient GetHisWsSoapClient()
        {
            var endpointAddress = ConfigurationManager.AppSettings["HisWsUrl"];

            var binding = new BasicHttpBinding();
            binding.MaxReceivedMessageSize = Int32.MaxValue;
            binding.MaxBufferSize = Int32.MaxValue;

            var ws = new HisWs.DefaultAcceptMessageClient(binding, new EndpointAddress(endpointAddress));
            return ws;
        }

        /// <summary>
        /// 取 广东省妇幼保健院 Lis Web Service 的代理类
        /// </summary>
        /// <returns></returns>
        public static HisWs.DefaultAcceptMessageClient GetLisWsSoapClient()
        {
            var endpointAddress = ConfigurationManager.AppSettings["LisWsUrl"];

            var binding = new BasicHttpBinding();
            binding.MaxReceivedMessageSize = Int32.MaxValue;
            binding.MaxBufferSize = Int32.MaxValue;
            var ws = new HisWs.DefaultAcceptMessageClient(binding, new EndpointAddress(endpointAddress));
            return ws;
        }

    }
}